package com.mxpio.erp.common.inventory.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.inventory.entity.Warehouse;
import com.mxpio.erp.common.technology.entity.ItemGroup;
import com.mxpioframework.jpa.annotation.DictAble;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author : 吴盼盼
 * @Datetime : 2022/10/28 22:58
 * @Desc :
 * @Modor :  Modifytime:
 * @modDesc :
 */
@Data
public class InventoryExportVO implements DictAble, Serializable{


    private static final long serialVersionUID = 1L;

    @Schema(description = "盘点单号")
    private String inventoryCode;

    /*@Schema(description = "单据类型")
    @Dict(dicCode="ERP_INV_INVENTORY_TYPE")
    private String inventoryType;*/

    @Schema(description = "单据状态")
    @Dict(dicCode="ERP_INV_INVENTORY_STATUS")
    private String inventoryStatus;

    /*@Schema(description = "盘点方法")
    @Dict(dicCode="ERP_INV_INVENTORY_WAY")
    private String inventoryWay;*/

    @Schema(description = "盘点范围")
    @Dict(dicCode="ERP_INV_INVENTORY_RANGE")
    private String inventoryRange;

    @Schema(description = "盘点比例(%)")
    private Integer inventoryPercentage;

/*    @Schema(description = "比例依据")
    @Dict(dicCode="ERP_INV_INVENTORY_RANGE_BASIS")
    private String inventoryRangeBasis;*/

    @Schema(description = "盘点仓库")
    @Dict(dicCode = "whCode" ,dicEntity = Warehouse.class, dicText = "whName")
    private String whCode;

    @Schema(description = "账务日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date busiDate;

    @Schema(description = "计划盘点日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date inventoryPlanDate;

    @Schema(description = "实际盘点日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date inventoryActualDate;


    @Schema(description = "盘点人员")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String inventoryPersons;

/*
    @Column(name = "MEMO_")
    @Schema(description = "备注")
    private String memo;
*/


    @Schema(description = "行号")
    private String lineNo;

    @Schema(description = "批次")
    private String lotNo;

    @Schema(description = "物料代码")
    private String itemCode;

    @Schema(description = "物料名称")
    private String itemName;

    @Schema(description = "物料组")
    @Dict(dicCode="groupCode", dicEntity = ItemGroup.class, dicText = "groupName")
    private String itemGroupCode;

    @Schema(description = "物料规格")
    private String itemSpec;

    @Schema(description = "单位编号")
    @Dict(dicCode="ERP_TECH_UNIT_CODE")
    private String unitCode;

    @Schema(description = "库存数量")
    private BigDecimal quantity;

    @Schema(description = "盘点数量")
    private BigDecimal inventoryNum;

/*    @Column(name = "DIFF_DESC_")
    @Schema(description = "账实差异")
    private String diffDesc;*/

    /**盈亏数量*/
    @Schema(description = "账实差异")
    private BigDecimal inventoryDiffNum;
    @Schema(description = "处理方式")
    @Dict(dicCode="ERP_INV_INVENTORY_HANDLE_METHOD")
    private String handleMethod;
    @Schema(description = "差异原因")
    private String diffReason;

    @Schema(description = "责任单位")
    private String responsibleUnit;

    @Schema(description = "备注")
    private String memo;



    private Map<String, String> textMap;
    @Override
    public String putText(String key, String value) {
        if (textMap == null) {
            textMap = new HashMap<>();
        }
        return textMap.put(key, value);
    }
}
